/******FIGURE A.V: EFFECTS ON VOTER REGISTRATION BY KILLING YEAR***********/

/*******RUN ANALYSIS**********/
use ../data/main_extended.dta, clear

global fixed_effects "cb pop_dec#elec_id CBG#elec_id"

forvalues y = 2004(2)2016 {

sum reg if tau_extended2==-1 & yr0==`y'
local m = round(r(mean), .01)
	

eventdd reg all if yr0==. | yr0==`y', timevar(tau_extended2)  ///
	absorb( $fixed_effects )  hdfe cluster(CBG) ///
	ci(rarea) ci_op(fcolor("gs10%30") lcolor(gs10))
	parmest, label saving (../estimates/figA5_yr`y', replace)

outreg2 using ../output/table_year.xls, append stats(coef se) ctitle(`y') dec(3) addtext(killings, `y', mean, `m') alpha(.01, .05, .10) symbol(***, **, *) excel

}

/*******CREATE FIGURES**********/
use ../estimates/figA5_yr2004, clear
gen yr = 2004
forvalues y = 2006(2)2016 {
append using ../estimates/figA5_yr`y'
replace yr = `y' if yr==.
}

keep if parm=="lag0"

local lwidth = "medthick"
local msize = "medlarge"
local estin "postmarket"
local tabout "postmarket"
local tsize = "medlarge"
local labsize = "small"
local titlesize = "vlarge"


local color1 = "navy"
local color2 = "maroon*0.65"
local symbol1 = "circle"
local symbol2 = "diamond"


local mcolor = "black"
local lcolor = "gs5"

graph twoway (scatter estimate yr, mcolor(`mcolor')) (rcap min95 max95 yr, lcolor(`lcolor')), ///
	yline(0, lcolor(gs5)) ///
	ylabel(-4(4)12, grid labsize(`labsize')) yscale(range(-4 12)) ///
	xlabel(2004 "2003-2004" 2006 "2005-2006" 2008 "2007-2008" 2010 "2009-2010" 2012 "2011-2012" 2014 "2013-2014" 2016 "2015-2016", labsize(`tsize')) ///
	xscale(range(2003.5 2016.5)) xsize(9) ysize(5) ///
	xtitle("Year of Killing", size(`tsize')) ytitle("Registrations", size(`tsize')) ///
	legend(off) plotregion(fcolor(white)) graphregion(fcolor(white) lwidth(large) lcolor(white)) bgcolor(white)

graph export ../output/figA5_year.png, replace
graph export ../output/figA5_year.eps, replace 
